﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using MetaSharp.Transformation;

[assembly: Transformer(".g", typeof(MetaSharp.Transformation.Grammar.GrammarTransformer))]

namespace MetaSharp.Transformation.Grammar
{
    // public transformer GrammarTransformer : TextTransformer {
    //     step Grammar grammar;
    //     step RoslynCompile compile;
    // }

    class GrammarTransformer : PatternTransformer
    {
        private ArrayList<Pattern> steps = new ArrayList<Pattern>();

        public GrammarTransformer()
        {
            var tokenizer = new Tokenizer();
            steps.Add(tokenizer.Main);
        }

        protected override IImmutableArray<Pattern> Steps
        {
            get { return this.steps; }
        }

        protected override IStream GetInput(System.IO.Stream content)
        {
            return new TextStream(new StreamReader(content, Encoding.UTF8, true));
        }

        protected override IEnumerable<TransformOutput> GetOutput(TransformationContext context, IMatch match)
        {
            yield break;
        }
    }
}
